import React, { useEffect } from 'react'
import Navbar from '@/comopnents/Navbar'
import styles from './index.module.less'
import { NavLink } from 'react-router-dom'
export default function Goodscolect() {
    // console.log(JSON.parse(localStorage.getItem('colectlist') as string).colectList);
    let aa = []
    let list = null
    if (localStorage.getItem('colectlist')) {
        aa = JSON.parse(localStorage.getItem('colectlist') as string).colectList
        list = localStorage.getItem('colectlist') ? aa : null
    }


    console.log(list);


    return (
        <div>
            <Navbar title='乐居'></Navbar>
            <div className={styles.listitem}>
                {
                    list ? list.map((item: { id: string, pic: string, detailTitle: string, price: string }) => <NavLink to={'/cate/goodsdetail?productId=' + item.id} key={item.id} className={styles.listitems}>
                        <div className={styles.boximg}>
                            <img style={{ width: '100%', height: '100%', objectFit: 'cover' }} src={item.pic} alt="" />
                        </div>
                        <div className={styles.boxcontents}>
                            <div className={styles.contitleBox}>{item.detailTitle}</div>
                            <div className={styles.bottomBox}>
                                <div>收藏</div>
                                <div className={styles.bottBox}>￥{item.price}</div>
                            </div>
                        </div>
                    </NavLink>) : <>暂无数据</>
                }
            </div>
        </div>
    )
}
